import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import java.util.*;


public class GUImouse extends MouseAdapter {
	private JList list;
	private GUI gui;

	public GUImouse(JList list, GUI gui) {
		this.list = list;
		this.gui = gui;
	}
	
	public void mouseClicked(MouseEvent e){
		if(e.getClickCount() == 2){
			int index = list.locationToIndex(e.getPoint());
			ListModel listModel = list.getModel();
			Object user = listModel.getElementAt(index);;
			list.ensureIndexIsVisible(index);
			//gui.joinChannel(gui.getNick() + " - " + user);
			gui.getClient().startPrivChat((String) user);
		}
	}
	
}
